<template>
  <div>
    <div>
      <router-link :to="{path:'/tree/Catalogue'}" class="me-3">
        回到目录
      </router-link>

      <router-link :to="{path:'/tree/AddStory',query: {id: -1,value: '未分类'}}" class="me-3">
        添加故事
      </router-link>
    </div>
    <div v-for="(item , index) in story" :key="index" class="m-3 d-flex">
      <div class="col-1">{{ index + 1 }}</div>
      <div class="col-11">{{ item.value }}</div>
    </div>
  </div>
</template>

<script>
import {StoryApi} from "@/api/api";
import {getJson} from "@/api/http";

export default {
  name: "StoryComponent",
  data() {
    return {
      story: [],
    }
  },
  methods: {
    async init() {
      let res3 = await getJson(StoryApi + "/" +  0, {});
      if (res3.code === 1) {
        this.story = res3.data
      } else {
        this.$message.error('失败');
      }
    }
  },
  created() {
    this.init()
  }
}
</script>

<style scoped>

</style>